package com.x.client.adapter

import android.support.v4.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.x.client.R
import com.x.client.bean.CarType

/**
 * Creator : GG
 * Date    : 2018/6/15
 * Mail    : gg.jin.yu@gmai.com
 * Explain :
 */
class BodyAdapter(data: List<CarType> = listOf()) : BaseQuickAdapter<CarType, BaseViewHolder>(R.layout.item_body, data) {
    override fun convert(helper: BaseViewHolder, item: CarType) {
        helper.setText(R.id.body, item.carTypeName)

        if (item.status) {
            helper.setTextColor(R.id.body, ContextCompat.getColor(mContext, R.color.white))
                    .setBackgroundRes(R.id.body, R.drawable.bg_body_select)
        } else {
            helper.setTextColor(R.id.body, ContextCompat.getColor(mContext, R.color.text_orange))
                    .setBackgroundRes(R.id.body, R.drawable.bg_body_default)
        }
    }
}